package Demo16_30.Test20;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by 14229 on 2020/1/22.
 */
public class Test {
    public static void main(String[] args) throws IOException {

        File f1 = new File("data.txt");
        File f2 = new File("result.txt");
        f1.createNewFile();
        f2.createNewFile();

        String s = FileUtils.readFileToString(f1);

        char[] chars = s.toCharArray();
        Set<Character> set = new HashSet<>();
        for (char aChar : chars) {
            set.add(aChar);
        }
        for (Character character : set) {
            FileUtils.writeStringToFile(f2,character+"",true);
        }
    }
}
